import { mock, type MockjsRequestOptions } from "mockjs";

export const userMock = () => {
  mock(/.*?\/api\/login/, (options: MockjsRequestOptions) => {
    console.log(options, "options");

    return {
      code: 0,
      data: {
        token:
          "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOjExLCJ1c2VybmFtZSI6InNhbSIsInJvbGUiOjEsImV4cCI6MTczNTk4MTM1OSwiaXNzIjoiamllZ2UifQ.UIckFLcqNBGUrRktXGYwEkE_kpt9HWd7uat7K3sIuPY",
      },
      msg: "mock登录成功",
    };
  });
};
export const userGenderMock = () => {
  mock(/.*?\/api\/user\/gender/, (options: MockjsRequestOptions) => {
    console.log(options, "options");

    return {
      code: 0,
      data: [
        {
          label: "男",
          value: 1,
        },
        {
          label: "女",
          value: 2,
        },
      ],
      msg: "成功",
    };
  });
};
export const userInfoMock = () => {
  mock(/.*?\/api\/userInfo/, (options: MockjsRequestOptions) => {
    console.log(options, "options");

    return {
      code: 0,
      message: "",
      data: {
        userID: 1,
        username: "Mock用户",
        nickname: "Sam",
        avatar: "",
        email: "1039778@qq.com",
        tel: "13983934298",
        addr: "", //内网地址
        token:
          "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOjExLCJ1c2VybmFtZSI6IuWNmuWuoueuoeeQhuWRmCIsInJvbGUiOjEsImV4cCI6MTAzNzU4NzI3NzYsImlzcyI6ImppZWdlIn0.jFZ_WeN1JBR6Nn6aPDpzNqAUxEHNE48pVO6vouEpMdc ",
        ip: "",
        role: 1, //1管理员 2普通用户
        sign_status: "",
        sign: "",
        link: "", //网站链接
      },
    };
  });
};
export const useListMock = () => {
  mock(/.*?\/api\/user\/list/, (options: MockjsRequestOptions) => {
    console.log(options, "options");

    return mock({
      code: 0,
      message: "",
      data: {
        count: 3,
        "list|3-7": [
          {
            code: 3,
            userID: 3,
            username: "张三",
            nickname: "zhangsan",
            avatar: "@img(100x100)",
            email: "1039770@qq.com",
            tel: "13983934298",
            addr: "", //内网地址
            token: "qwe123",
            ip: "",
            role: 2, //1管理员 2普通用户
            sign_status: "",
            sign: "",
            link: "", //网站链接
            created_at: "2024-12-25 09:21:56.441",
          },
        ],
      },
    });
  });
};
